package com.woniuxy.demo.epai.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 胡八一
 * @date 2021/04/13 12:57
 */
@Component
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedHeaders("*")
                .allowedMethods("POST","GET","PUT","DELETE")
                .allowCredentials(true)//允许携带cookie
                .allowedOriginPatterns("*");
    }

}
